FROM node:14.19 AS build

WORKDIR /app
COPY . /app

RUN yarn --registry https://registry.npm.taobao.org
RUN yarn build

# 设置基础镜像
FROM nginx:1.20.2 AS deploy

LABEL maintainer="HYZhu <zhuhy163@163.com>"

# Args

ARG BUILD_DATE

ARG BUILD_VERSION

# Labels

LABEL org.label-schema.schema-version="1.0"

LABEL org.label-schema.build-date=$BUILD_DATE

LABEL org.label-schema.vendor="wx-rdc"

LABEL org.label-schema.version=$BUILD_VERSION

COPY --from=build /app/preview/  /usr/share/nginx/html
COPY --from=build /app/nginx/conf/default.conf /etc/nginx/conf.d/